<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@page import="servlet.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style >
	.even{background-color:gray}
	.odd{background-color:white}
</style>
</head>
<body>
	<%
		String uname = (String)request.getAttribute("name");
		
	%>
	<%= uname %>
	<hr/>
	<% 
		
		User u = (User)session.getAttribute("u");
		
		out.print(u.getName());
	 %>
	  
	 <hr/>
	 <h1>session attribute: ${sessionScope.u.name }</h1>
	 
	 <hr/>
	 <h1>request attribute: ${u.name }</h1>
	 
	 <hr/>
	 <table>
	 	<c:forEach items="${us }" var="uu" varStatus="a" begin="2" end="5">
	 	<tr>
	 		<td>${uu.id }</td><td>${uu.name }</td>
	 		<td>${a.index }</td>
	 	</tr>
	 	</c:forEach>
	 </table>
	 
	 <table>
	 	<c:forEach items="${us }" var="uu" varStatus="a">
	 	<c:if test="${a.index%2==0 }">
	 		<tr class="even">
	 	</c:if>
	 	<c:if test="${a.index%2==1 }">
	 		<tr class="odd">
	 	</c:if>
	 	
	 		<td>${uu.id }</td><td>${uu.name }</td>
	 		<td>
	 			<c:if test="${uu.sex }">男</c:if>
	 			<c:if test="${!uu.sex }">女</c:if>
	 		</td>
	 		<td>
	 			<fmt:formatDate value="${uu.birth }" pattern="yyyy年MM月dd日" />
	 		</td>
	 		<td>
	 			<fmt:formatNumber value="${uu.sal }" pattern="$##,###.00" />
	 		</td>
	 	</tr>
	 	</c:forEach>
	 </table>
	 
	
</body>
</html>